package com.example.webflux_module.handler;

import cn.hutool.core.thread.ThreadUtil;
import com.example.webflux_module.entity.Result;
import com.example.webflux_module.entity.Results;
import com.example.webflux_module.support.route.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;


@Slf4j
@Component
public class EchoHandler {

    @Api(path = "aaaaaaaaa")
    public Mono<ServerResponse> getAllUser(ServerRequest request) {
        Mono<Result> allUser = Mono.just(Results.ok());
        log.info("sadfasdfasd");
        ThreadUtil.sleep(5000);
        return ServerResponse.ok()
                .contentType(MediaType.APPLICATION_JSON)
                .body(allUser, Result.class);
    }
}
